package com.mall.portal.web.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.mall.content.service.ContentService;
import com.mall.manager.pojo.TbContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @author Administrator
 */

@Controller
public class PortalController {

    @Value("${INDEX_LUNBO_ID}")
    private long INDEX_LUNBO_ID;

    @Reference(timeout = 100000)
    private ContentService contentService;

    /**
     * 查询首页动态信息
     * @param model
     * @return
     */
    @GetMapping("/")
    public String showIndex(Model model){
        List<TbContent> lunboContents = contentService.listIndexContents(INDEX_LUNBO_ID);
        model.addAttribute("ad1List",lunboContents);
        return "index";
    }
}
